package gunfire.cards;

import basemod.abstracts.CustomCard;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.DamageAction;
import com.megacrit.cardcrawl.actions.common.MakeTempCardInHandAction;
import com.megacrit.cardcrawl.actions.common.RemoveAllBlockAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import gunfire.GunfireMod;
import gunfire.actions.ElementalEffectAction;

import static gunfire.GunfireMod.ELEMENT_DAMAGE;
import static gunfire.GunfireMod.makeCardPath;

public class Sting3 extends CustomCard {

    public static final String ID = GunfireMod.makeID(Sting3.class.getSimpleName());
    private static final CardStrings cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    public static final String NAME = cardStrings.NAME;
    public static final String DESCRIPTION = cardStrings.DESCRIPTION;
    public static final String IMG = makeCardPath("Sting3.png");
    private static final CardRarity RARITY = CardRarity.SPECIAL;
    private static final CardType TYPE = CardType.ATTACK;
    private static final CardTarget TARGET = CardTarget.ENEMY;
    public static final CardColor COLOR = CardColor.COLORLESS;
    private static final int COST = 0;

    public Sting3() {
        super(ID, NAME, IMG, COST, DESCRIPTION, TYPE, COLOR, RARITY, TARGET);
        this.baseDamage = 5;
        this.baseMagicNumber = this.magicNumber = 2;
        this.exhaust = true;
        this.isEthereal = true;

        this.tags.add(GunfireMod.ELEMENT_DAMAGE_CARD);
        this.damageType = this.damageTypeForTurn = GunfireMod.ELEMENT_DAMAGE;
    }

    @Override
    public void upgrade() {
        if (!this.upgraded) {
            this.upgradeName();
            this.upgradeDamage(2);
            this.upgradeMagicNumber(1);
        }
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        this.addToBot(new RemoveAllBlockAction(m, p));
        this.addToBot(new DamageAction(m, new DamageInfo(p, this.damage, ELEMENT_DAMAGE), AbstractGameAction.AttackEffect.POISON));
        this.addToBot(new ElementalEffectAction(m, p, this.magicNumber, GunfireMod.ElementalEffect.Decay));
    }

    @Override
    public AbstractCard makeCopy() {
        return new Sting3();
    }
}
